home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16829 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  952 b 

  1. Path: inforamp.net!usenet
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: new with multidimensional arrays
  5. Date: Fri, 12 Apr 1996 15:24:00 GMT
  6. Organization: InfoRamp Inc., Toronto, Ontario (416) 363-9100
  7. Message-ID: <4kli21$blc@sam.inforamp.net>
  8. References: <3169B9C3.2A10@MIT.EDU>
  9. NNTP-Posting-Host: ts10-10.tor.istar.ca
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Darrel K Robertson <dkr1@MIT.EDU> wrote:
  13.  
  14. >Hi, I wonder if anyone can help me. I want to use "new" to create a 
  15. >multidimensional array, but don't know how. So far I have:
  16. >complex *grid;
  17. >scanf("%d %d", &nc, &nr);
  18. >grid = new complex[nc][nr];
  19.  
  20. complex **grid;
  21. scanf("%d %d", &nc, &nr);
  22. grid = new complex *[nc];
  23. for (int i=0;i<nr;i++)
  24.     grid[i] = new complex[nr];
  25.  
  26. Or something like that.
  27.  
  28.  
  29.  
  30. Agrivar
  31.  
  32. aka Randy Charles Morin,
  33. MiddleWorld SoftWare,
  34. Satisfying Your Bit and Bytes,
  35. Canada 1-800-363-3780 
  36. Other  1-905-279-2087
  37. eMail  rmorin@inforamp.net
  38.  
  39.